<h1>Registarse</h1>
<?php

$attributes = array('class' => 'user_register');
echo form_open('users/register',$attributes);
$name = array(
			  'id'          => 'reg_name',
			  'name'        => 'name',
			  'value'		=> set_value('name'),
			  'maxlength'   => '50',
			  'tabindex'	=> '1',
			  'autocomplete'=> 'off'
);
$username = array(
			  'id'          => 'reg_username',
			  'name'        => 'username',
			  'value'		=> set_value('username'),
			  'maxlength'   => '50',
			  'tabindex'	=> '2',
			  'autocomplete'=> 'off'

);
$email = array(
			  'id'          => 'reg_email',
			  'name'        => 'email',
			  'value'		=> set_value('email'),
			  'maxlength'   => '50',
			  'tabindex'	=> '3'
);
$password = array(
			  'id'          => 'reg_password',
			  'name'        => 'password',
			  'value'		=> '',
			  'maxlength'   => '50',
			  'type'		=>'password',
			  'tabindex'	=> '4'
);
$re_password = array(
			  'id'          => 'reg_re_password',
			  'name'        => 're_password',
			  'value'		=> '',
			  'maxlength'   => '50',
			  'type'		=>'password',
			  'tabindex'	=> '5'
);
$capt = array(
			  'id'          => 'reg_captcha',
			  'name'        => 'captcha',
			  'value'		=> '',
			  'maxlength'   => '50',
			  'tabindex'	=> '6',
			  'autocomplete'=> 'off'
);
echo '<div>';
echo form_label('Nombre','name');
echo form_input($name);
echo form_error('name');
echo form_label('Nombre de usuario','username');
echo form_input($username);
echo form_error('username');
echo form_label('Email','email');
echo form_input($email);
echo form_error('email');
echo form_label('Contraseña','password');
echo form_input($password);
echo form_error('password');
echo form_label('Confirme contraseña','re_password');
echo form_input($re_password);
echo form_error('re_password');


echo form_label('Ingrese el código de la figura','captha');
echo '<div id="captcha">';
echo $captcha['image'];
echo '<div id="reload_capcha"></div>';
echo '</div>';
echo form_input($capt);
echo form_error('captcha');

echo form_submit(array('name'=>'submit','tabindex'=>'7'),'Registrarse');
echo '</div>';

echo form_close();

?>
<script type="text/javascript">
	$('#reg_name').focus();
	$('#reload_capcha').click(function(){
		url ="reloadCaptcha";
		$.getJSON(url, function(data){
			$('#captcha img').replaceWith(data.img);
		});
	});
</script>